<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>星级评分之第四种实现方式</title>
    <style>
      .rating {
        position: relative;
        width: 300px;
        height: 56px;
        background: url(img/twoStar.jpg) repeat-x;
        margin: 100px auto;
      }
      .rating-item {
        position: absolute;
        top: 0;
        z-index: 3;
        width: 70px;
        height: 56px;
      }
      .rating-item-1 {
        left: 0;
      }
      .rating-item-2 {
        left: 56px;
      }
      .rating-item-3 {
        left: 112px;
      }
      .rating-item-4 {
        left: 168px;
      }
      .rating-item-5 {
        left: 224px;
      }
      .rating-item:hover {
        left: 0;
        z-index: 2;
        background: url(img/twoStar.jpg) repeat-x 0 -56px;
      }
      .rating-item-1:hover {
        width: 56px;
      }
      .rating-item-2:hover {
        width: 112px;
      }
      .rating-item-3:hover {
        width: 170px;
      }
      .rating-item-4:hover {
        width: 235px;
      }
      .rating-item-5:hover {
        width: 300px;
      }
    </style>
  </head>
  <body>
    <div class="rating">
      <a href="javascript:;" class="rating-item rating-item-1" title="很不好"></a>
      <a href="javascript:;" class="rating-item rating-item-2" title="不好"></a>
      <a href="javascript:;" class="rating-item rating-item-3" title="一般"></a>
      <a href="javascript:;" class="rating-item rating-item-4" title="好"></a>
      <a href="javascript:;" class="rating-item rating-item-5" title="很好"></a>
    </div>
  </body>
</html>